package mybatis02.user.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import mybatis02.user.entity.UserEntity;

public interface UserDao {
	
	@Select("select * from users where id=#{id}")
	UserEntity findByid(Integer id);
	
	@Select("select * from users")
	List<UserEntity> findUsers();
	
	@Insert("insert into users(name, age) values(#{name}, #{age})")
	int insertUser(UserEntity entity);
	
	@Delete("delete from users where id=#{id}")
	int deleteByUser(Integer id);
	
	@Update("update users set name=#{name},age=#{age} where id=#{id}")
	int  updateUser(UserEntity entity);
	
	
	

}
